home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 32 / Mac Magazin and MacEasy Magazine CD - Issue 32.iso / Multimedia / PlayerPRO 4.5.5 Dev.Kit / Plug-Ins / Sound Filters Plugs / Silence.c < prev    next >
C/C++ Source or Header  |  1995-10-08  |  2KB  |  70 lines

  1. /*
  2.     Player PRO 4.4x PlugIns
  3.  
  4.     Antoine ROSSET
  5.     16 Tranchees
  6.     1206 GENEVA
  7.     SWITZERLAND
  8.     
  9.     FAX: 022 789 35 03
  10.     Compuserve: 100277,164
  11.  
  12. /********************************************************/
  13.  
  14. // Exemple: SILENCE PlugIns. Set Selection to 0.
  15.  
  16. #include "MAD.h"
  17. #include "PPPlug.h"
  18.  
  19. #if defined(powerc) || defined(__powerc)
  20. enum {
  21.         PlayerPROPlug = kCStackBased
  22.         | RESULT_SIZE(SIZE_CODE( sizeof(OSErr)))
  23.         | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof( sData*)))
  24.         | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof( long)))
  25.         | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof( long)))
  26.         | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof( PPInfoPlug*)))
  27. };
  28.  
  29. ProcInfoType __procinfo = PlayerPROPlug;
  30. #else
  31. #include <A4Stuff.h>
  32. #endif
  33.  
  34.  
  35. OSErr main(     sData                    *theData,                // Sample Informations
  36.                 long                    SelectionStart,            // SelectionStart in bytes ! Even for 16bits audio
  37.                 long                    SelectionEnd,            // SelectionEnd in bytes ! Even for 16bits audio
  38.                 PPInfoPlug                *thePPInfoPlug)            
  39. {
  40.     long    i;
  41.     Ptr        Sample8Ptr = theData->data;
  42.     short    *Sample16Ptr = (short*) theData->data;
  43.  
  44.     if( Sample8Ptr == 0L) return noErr;
  45.  
  46.     switch( theData->amp)
  47.     {
  48.         case 8:
  49.             Sample8Ptr += SelectionStart;
  50.     
  51.             for( i = 0; i < SelectionEnd - SelectionStart; i++)
  52.             {
  53.                 *Sample8Ptr = 0;
  54.                 Sample8Ptr++;
  55.             }
  56.         break;
  57.         
  58.         case 16:
  59.             Sample16Ptr += SelectionStart/2;                        // Div 2, because it's in bytes !!!
  60.  
  61.             for( i = 0; i < (SelectionEnd - SelectionStart)/2; i++)    // Div 2, because it's in bytes !!!
  62.             {
  63.                 *Sample16Ptr = 0;
  64.                 Sample16Ptr++;
  65.             }
  66.         break;
  67.     }
  68.     
  69.     return noErr;
  70. }